<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>班级修改</title>

    <link rel="stylesheet" type="text/css" href="/static/js/layui-v2.5.7/layui/css/layui.css">
    <script type="text/javascript" src="/static/js/layui-v2.5.7/layui/layui.js"></script>
    <script type="text/javascript" src="/static/js/myJs.js"></script>

    <script>
        layui.use(['form', 'table'], function () {
            var form = layui.form;
            window.table = layui.table;
        })
    </script>


</head>
<body>

<a href="SelectClasses" class="layui-btn layui-btn-radius layui-btn-primary">
    <i class="layui-icon">&#xe65a;</i>
</a>

<form class="layui-form">

    <div class="layui-form-item">
        <div class="layui-input-inline">
            <input type="hidden" name="id" id="id" value="{$id}">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label" for="name">班级名字</label>
        <div class="layui-input-inline">

            <input type="text" name="name" id="name"
                   placeholder="请输入班级名字" autocomplete="off" required
                   class="layui-input">
        </div>
        <a class="layui-btn layui-btn-danger" onclick="Update()">修改</a>
    </div>
</form>

<script type="text/javascript" src="http://owner.liuheng.com/static/js/jQuery-2.2.0.min.js"></script>
<script>

    $(document).ready(function () {
        $.ajax({
            dataType: "json",
            url: "/studentLayer/Classes/UpdateClasses",
            method: "POST",
            data: {id: $("#id").val()},
            success: function (data) {
                var html = data.shop.name;
                $("#name").val(html);
                console.log(html);
                $("#name").html(html);

            }
        })
    })

    function Update() {

        $.ajax({
            dataType: "json",
            url: "/studentLayer/Classes/AjaxUPdate",
            method: "POST",
            data: {
                "id": $("#id").val(),
                "name": $("#name").val()
            },
            success: function (data) {

                var index = parent.layer.getFrameIndex(window.name);
                parent.location.reload(index);
                parent.layer.close(index);
                window.location.href = "/studentLayer/Classes/SelectClasses"
            }
        })

    }


</script>


</body>
</html>